﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using CuteSprite.Eme.Client;
using CuteSprite.Eme.Data;
using CuteSprite.Eme.Data.BsdUserCenter;
using CuteSprite.Eme.Data.CRM;
using CuteSprite.Eme.MIS.Client;
using CuteSprite.Eme.UI.Utils;
using HmFramework.Components;
using HmFramework.Components.Controls;
using HmFramework.Components.Editors.DateTimeAdv;
using HmFramework.Data;
using HmFramework.Data.Configuration;
using HmFramework.Log;
using HmFramework.UI.Utils;
using HmFramework.UI.Utils.Controls;
using HmFramework.Reflection;
using HmFramework.Threading;


namespace CuteSprite.Eme.UI.Test
{
	public partial class Template : EmeEntityForm
	{

		#region -- Fields --
		#endregion


		#region -- 构造 --

		#region - 新增 -

		/// <summary>默认构造函数</summary>
		public Template()
			: base()
		{
			//InitializeComponent();
			InitForm();
		}

		/// <summary>构造函数</summary>
		/// <param name="templateFileName">模板文件</param>
		public Template(String templateFileName)
		{
			SetupFromXml(templateFileName);
			InitForm();
		}

		/// <summary>构造函数</summary>
		/// <param name="resourceName">模板资源文件</param>
		/// <param name="asm">模板资源文件所在程序集</param>
		public Template(String resourceName, Assembly asm)
		{
			SetupFromXmlResource(resourceName, asm);
			InitForm();
		}

		/// <summary>构造函数</summary>
		/// <param name="stream">模板数据流</param>
		public Template(Stream stream)
		{
			SetupFromXmlStream(stream);
			InitForm();
		}

		#endregion

		#region - 编辑或新增 -

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		public Template(IEntity entity)
			: this(entity, false)
		{
		}

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		/// <param name="readOnly">是否只读，指定编辑还是浏览实体信息</param>
		public Template(IEntity entity, Boolean readOnly)
			: base(entity, readOnly)
		{
			//InitializeComponent();
			InitForm();
		}

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		/// <param name="templateFileName">模板文件</param>
		public Template(IEntity entity, String templateFileName)
			: this(entity, templateFileName, false)
		{
		}

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		/// <param name="templateFileName">模板文件</param>
		/// <param name="readOnly">是否只读，指定编辑还是浏览实体信息</param>
		public Template(IEntity entity, String templateFileName, Boolean readOnly)
			: base(entity, readOnly)
		{
			SetupFromXml(templateFileName);

			InitForm();
		}

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		/// <param name="resourceName">模板资源文件</param>
		/// <param name="asm">模板资源文件所在程序集</param>
		public Template(IEntity entity, String resourceName, Assembly asm)
			: this(entity, resourceName, asm, false)
		{
		}

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		/// <param name="resourceName">模板资源文件</param>
		/// <param name="asm">模板资源文件所在程序集</param>
		/// <param name="readOnly">是否只读，指定编辑还是浏览实体信息</param>
		public Template(IEntity entity, String resourceName, Assembly asm, Boolean readOnly)
			: base(entity, readOnly)
		{
			SetupFromXmlResource(resourceName, asm);

			InitForm();
		}

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		/// <param name="stream">模板数据流</param>
		public Template(IEntity entity, Stream stream)
			: this(entity, stream, false)
		{
		}

		/// <summary>构造函数</summary>
		/// <param name="entity">实体对象</param>
		/// <param name="stream">模板数据流</param>
		/// <param name="readOnly">是否只读，指定编辑还是浏览实体信息</param>
		public Template(IEntity entity, Stream stream, Boolean readOnly)
			: base(entity, readOnly)
		{
			SetupFromXmlStream(stream);

			InitForm();
		}

		#endregion

		#endregion


		#region -- 属性 --

		private EmeBsdMisManagement _BsdMisManagement = null;

		/// <summary>BsdMIS客户端管理</summary>
		protected EmeBsdMisManagement BsdMisManagement
		{
			get
			{
				if (_BsdMisManagement == null) { _BsdMisManagement = ServerManagement as EmeBsdMisManagement; }
				return _BsdMisManagement;
			}
		}

		#endregion

		#region -- 窗体事件 --

		#region - method InitComponent -

		/// <summary>控件初始化</summary>
		protected override void InitComponent()
		{
			base.InitComponent();



		}

		#endregion

		#region - method FormOnLoad -

		public override void FormOnLoad()
		{
			base.FormOnLoad();

		}

		#endregion

		#region - method FormOnPreLoad -

		protected override void FormOnPreLoad()
		{
			base.FormOnPreLoad();

			//MessageBox.Show("这个" + "FormOnPreLoad()");

		}
		#endregion

		#region - method InitCurrentEntityWhenNewAdd -

		protected override void InitCurrentEntityWhenNewAdd()
		{
			base.InitCurrentEntityWhenNewAdd();
			//MessageBox.Show("这个" + "InitCurrentEntityWhenNewAdd()");

		}
		#endregion

		#region - method FormOnShown -

		public override void FormOnShown()
		{
			base.FormOnShown();


		}

		#endregion

		#region - 刷新窗体 -

		public override void ResetForm()
		{

		}

		private void RefreshFieldControls()
		{

		}

		#endregion

		#region - 实体保存 -

		private void FrmExpress_OnSaving(object sender, EntityFormEventArgs e)
		{

		}

		#endregion

		#region - 实体验证 -

		private void FrmExpress_OnValid(object sender, EntityFormEventArgs e)
		{

		}

		#endregion

		#region - 实体保存成功 -

		private String m_recStaffValue;

		private void FrmExpress_OnSaveSuccess(object sender, EntityFormEventArgs e)
		{

		}

		#endregion

		private void InitializeComponent()
		{
			this.SuspendLayout();
			// 
			// Template
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
			this.ClientSize = new System.Drawing.Size(284, 262);
			this.DoubleBuffered = true;
			this.Name = "Template";
			this.Text = "c";
			this.ResumeLayout(false);

		}

		#endregion

		#region -- 控件事件 --


		#endregion

		#region -- 辅助 --


		#endregion
	}
}
